<?php
namespace app\index\logic;
use think\Db;

class Token
{
    /*
     * 写入新的token
     */
    public function writeToken($uid)
    {
        $token = createToken($uid);

        $res = Db::name('quick_user')->where('id',$uid)->update(['token'=>$token]);
        if($res)
        {
            return ['code' => 0, 'data' => $token];
        }else{
            return ['code'=>102,'msg'=>'凭证写入失败'];
        }

    }
}